package tp.badugi.client;

import java.io.IOException;

import tp.badugi.client.exceptions.TableNotCreatedClientException;
import tp.badugi.client.exceptions.TableNotJoinedClientException;
import tp.badugi.net.GameStatus;
import tp.badugi.net.exceptions.IllegalCharactersException;
import tp.badugi.net.exceptions.IllegalParameterValueException;
import tp.badugi.net.exceptions.NameTakenException;
import tp.badugi.net.exceptions.NoSuchTableException;
import tp.badugi.net.exceptions.RequestTimedOutException;
import tp.badugi.net.exceptions.ServerCouldNotCompleteRequestException;
import tp.badugi.net.exceptions.TableFullException;

public interface iClientBridgeAdapter {
	
	//--------------------Client to server methods
	
	public void connect(String ipAddress, int portNumber) 
			throws IOException, ServerCouldNotCompleteRequestException,
			RequestTimedOutException;
	
	public void disconnectFromServer() throws IOException;
	
	public void disconnectAndExitProgram() throws IOException;
	
	public void reconnect(String ipAdress, int port, String tableName, String myName);
	
	public void joinTable(String tableName, String myNickame)
			throws TableFullException, IllegalArgumentException, IllegalCharactersException,
			ServerCouldNotCompleteRequestException, NameTakenException,
			NoSuchTableException, RequestTimedOutException, TableNotJoinedClientException;

	public void leaveTable() throws ServerCouldNotCompleteRequestException, RequestTimedOutException;
	
	public void refreshTableList()
			throws ServerCouldNotCompleteRequestException, RequestTimedOutException;
	
	public void createTable(String tableName, String myNickname, int tableSize,
								long startingChips, long smallBlind, long bigBlind)
			throws NameTakenException, IllegalCharactersException, IllegalParameterValueException,
			ServerCouldNotCompleteRequestException, RequestTimedOutException, TableNotCreatedClientException;
	
	public void changeCards(String[] cardsToChange);
	
	public void makeAction(String action, long amountOfChips);
	
	public void Shuffle();

	//-----------------------Server to client methods
	
	public void passErrorMessage(String errorMessage);

	public void passConnectionMessage(String connectionMessage);

	public void passValidationMessage(String validationMessage);

	public void updateGameAndConsole(String consoleMessage);
	
	public void updateGameStatus();
	
	public void passCardRequest(int cardChangetimeout);
	
	public void passActionRequest(String[] possibleActions, int actionTimeout);
	
	public void passWinnerView(String[][] revealedPlayersCards, String[] winnersNames, long[] chipsAddedFromPot, int[] winnersIndexes);
	
	public void emergrncyClientReset();
	
	//---------------------- Client request methods
	public GameStatus getGameStatus();
}
